package com.sec.typhoondatapush;

import com.sec.typhoondatapush.service.QuartzTableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 动态修改定时任务
 *
 * @author zhuwq
 * @version V1.0
 * @date Create in  2018/7/30- 15:11
 */
@SpringBootApplication
@Slf4j
public class TyphoonDataPushApplication implements CommandLineRunner {

    @Autowired
    private QuartzTableService quartzTableService;

    public static void main(String[] args) {
        SpringApplication.run(TyphoonDataPushApplication.class, args);
    }

    /**
     * 初始化完成后通过commandLine模式启动所有active的定时任务。
     *
     * @date Create in  2018/7/30- 15:11
     * @author zhuwq
     */
    @Override
    public void run(String... strings) throws Exception {
        log.info("启动所有任务。");
        quartzTableService.startAllJobs();
    }
}
